{% extends 'web/base.html' %}
{% load staticfiles %}

<!--{% block manifest %} appcache/channel.appcache {% endblock %}-->

{% block base_title %} 我的推广 {% endblock %}

{% block base_body %}
<div class="channel scroll" id="channel">
    <div class="channel_b">
        <div class="channel_b_phone">
            渠道号码：<span v-html="qudao"></span>
        </div>
        <div class="channel_b_er">
            <p>渠道二维码</p>
            <div class="channel_b_img">
                <img  width="100%" src="data:image/png;base64,{{ code }}" alt="">
            </div>
        </div>
        <div style="width: 6.5rem;margin: 1rem auto">
            <a :href="'/xz/login/?phone='+phone+'&pass='+pass+'&redir=channellist'"><button onclick="" class="click_txt down_btn">查看我的推荐用户></button></a>

        </div>
    </div>
</div>
{% endblock %}

{% block base_script %}
    var channel = new Vue({
        el:'#channel',
        data:{
            userid:localStorage.getItem('uid'),
            qudao:'',
            phone:localStorage.getItem('phone'),
            pass: localStorage.getItem('pass'),
            qudao: localStorage.getItem('qudao'),
        },
        methods: {
            getMe:function(){
              this.userid=localStorage.getItem('uid');
              this.phone=localStorage.getItem('phone');
              this.pass=localStorage.getItem('pass');
                if(this.qudao == null || this.qudao == 'undefined'){
                    var self = this;
                    reqwest({
                        url: 'http://api.zgtxcj.com/txcjapi/user_mess/?id=' + self.userid,
                        method: 'get',
                        type: 'json',
                        success:function(resp){
                            self.qudao=resp['U_Number'];
                            localStorage.setItem('qudao', self.qudao);
                        }
                    })
                }
            },
            run:function () {
                this.getMe();
            }
        },
    })
{% endblock %}

{% block base_run %}channel{% endblock %}
